import { computed, getCurrentInstance, inject } from 'vue'
const useProp = (name: string, defalutValue?: any) => {
  const vm = getCurrentInstance()!
  const ij = inject(name, undefined)
  // if (name === 'index') {
  //   console.log((vm.proxy?.$props as any)[name], ij)
  // }
  if ((vm.proxy?.$props as any)[name] === 0) return computed(() => (vm.proxy?.$props as any)[name])

  return computed(() => (vm.proxy?.$props as any)[name] || ij || defalutValue || undefined)
}
export default useProp
